package com.lily.user.api;

import com.lily.user.domain.UserDM;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;

import java.util.List;


@FeignClient(value = "user-service", fallbackFactory = UserDomainApiClient.UserDomainApiFallbackFactory.class)
public interface UserDomainApiClient extends UserDomainIApi {

    @Component
    class UserDomainApiFallbackFactory implements FallbackFactory<UserDomainApiFallbackWithFactory> {

        @Override
        public UserDomainApiFallbackWithFactory create(Throwable cause) {
            return new UserDomainApiFallbackWithFactory();
        }
    }

    class UserDomainApiFallbackWithFactory implements UserDomainApiClient {
        @Override
        public List<UserDM> getAll(UserDM userDM) {
            return List.of();
        }

        @Override
        public UserDM add(UserDM userDM) {
            return null;
        }

        @Override
        public List<UserDM> page(UserDM userDM, Integer current, Integer size) {
            return List.of();
        }

        @Override
        public UserDM queryOne(UserDM userDM) {
            return null;
        }

        @Override
        public UserDM update(UserDM userDM) {
            return null;
        }

        @Override
        public UserDM delete(UserDM userDM) {
            return null;
        }
    }

}



